#!/bin/bash

set -ex

distributionManagement="\n\
\t<distributionManagement>\n\
\t\t<repository>\n\
\t\t\t<id>nexus</id>\n\
\t\t\t<name>Releases</name>\n\
\t\t\t<url>http://101.132.110.150:8081/repository/maven-releases/</url>\n\
\t\t</repository>\n\
\t\t<snapshotRepository>\n\
\t\t\t<id>nexus</id>\n\
\t\t\t<name>Snapshot</name>\n\
\t\t\t<url>http://101.132.110.150:8081/repository/maven-snapshots/</url>\n\
\t\t</snapshotRepository>\n\
\t</distributionManagement>"

mvn clean
mvn archetype:create-from-project
cd target/generated-sources/archetype/
sed -i '/<\/project>/i\'$distributionManagement pom.xml
mvn install
mvn deploy
cd -
